package com.mygdx.game.Stage.Fight;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;

public class PassButton {
    private static Texture upTexture;
    private static Texture downTexture;
    private static Button button;
    private PassButton(){
        super();
    }

    public static Button getButton(){
        if (button==null){
            //设置按下的不同纹理
            upTexture = new Texture(Gdx.files.internal("com/mygdx/game/Stage/Fight/button.png"));
            downTexture = new Texture(Gdx.files.internal("com/mygdx/game/Stage/Fight/button-press.png"));


            Button.ButtonStyle style = new Button.ButtonStyle();

            // 设置 style 的 弹起 和 按下 状态的纹理区域
            style.up = new TextureRegionDrawable(new TextureRegion(upTexture));
            style.down = new TextureRegionDrawable(new TextureRegion(downTexture));

            button = new Button(style);

            button.setPosition(1500,500);

            return button;

        }else return button;

    }
}
